import React, { Component } from 'react'
import moment from 'moment'
import styles from './Content.module.scss'

export default class HotNewsContent extends Component {

  onNewsItem(item) {
    this.props.onItem(item)
  }

  render() {
    const { datas } = this.props
    return (
      <div className={styles.hotNews_content}>
        <ul>
          {datas && datas.map((item, index) => {
            return (
              <li key={index} onClick={() => this.onNewsItem(item)}>
                <div>{item.title || ''}</div>
                <span>{moment(item.public_at).format('YYYY-MM-DD') || ''}</span>
              </li>
            )
          })}
        </ul>
      </div>
    )
  }
}
